<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>考试答题页面</title>
    <script src="../static/js/jquery.js"></script>
    <style>
        /* 全局样式 - 完全自定义，不依赖外部库 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        }
        :root {
            --primary-color: #3b82f6;
            --primary-dark: #2563eb;
            --primary-light: #eff6ff;
            --secondary-color: #64748b;
            --success-color: #10b981;
            --danger-color: #ef4444;
            --text-color: #1e293b;
            --text-light: #64748b;
            --border-color: #e2e8f0;
            --bg-color: #f8fafc;
            --card-bg: #ffffff;
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --transition: all 0.2s ease;
        }
        body {
            background-color: var(--bg-color);
            color: var(--text-color);
            line-height: 1.5;
        }

        /* 按钮样式 - 纯自定义实现 */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.5rem 1rem;
            border-radius: 0.375rem;
            font-weight: 500;
            font-size: 0.875rem;
            cursor: pointer;
            transition: var(--transition);
            border: none;
        }

        .btn.primary {
            background-color: var(--primary-color);
            color: white;
        }

        .btn.primary:hover {
            background-color: var(--primary-dark);
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
        }

        .btn.danger {
            background-color: var(--danger-color);
            color: white;
        }

        .btn.danger:hover {
            background-color: #dc2626;
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
        }

        /* 表单元素样式 */
        .form-control {
            width: 100%;
            padding: 0.625rem 1rem;
            border: 1px solid var(--border-color);
            border-radius: 0.375rem;
            font-size: 0.875rem;
            transition: var(--transition);
        }

        .form-control:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        textarea.form-control {
            min-height: 120px;
            resize: vertical;
            line-height: 1.6;
        }

        /* 主容器样式 */
        .main-container {
            padding: 1.5rem;
            max-width: 1400px;
            margin: 0 auto;
        }

        /* 顶部导航栏 */
        .exam-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-color);
        }

        .exam-title {
            font-size: 1.5rem;
            font-weight: 600;
            color: var(--text-color);
        }

        .timer-container {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .timer {
            background-color: var(--card-bg);
            padding: 0.5rem 1rem;
            border-radius: 0.375rem;
            box-shadow: var(--shadow);
            font-weight: 600;
            color: var(--text-color);
        }

        .timer.warning {
            color: var(--danger-color);
            animation: pulse 1s infinite alternate;
        }

        @keyframes pulse {
            from { opacity: 1; }
            to { opacity: 0.7; }
        }

        /* 主要内容区 */
        .exam-content {
            display: flex;
            gap: 1.5rem;
            min-height: calc(100vh - 120px);
        }

        /* 左侧题目导航区 */
        .question-nav {
            width: 280px;
            background-color: var(--card-bg);
            border-radius: 0.5rem;
            box-shadow: var(--shadow);
            padding: 1rem;
            height: fit-content;
            max-height: calc(100vh - 120px);
            overflow-y: auto;
        }

        .question-type {
            margin-bottom: 1.5rem;
        }

        .question-type h3 {
            font-size: 1rem;
            margin-bottom: 0.75rem;
            color: var(--text-color);
            padding-bottom: 0.25rem;
            border-bottom: 1px solid var(--border-color);
        }

        .question-numbers {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
        }

        .question-number {
            width: 2.5rem;
            height: 2.5rem;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.375rem;
            border: 1px solid var(--border-color);
            font-size: 0.875rem;
            cursor: pointer;
            transition: var(--transition);
        }

        .question-number:hover {
            border-color: var(--primary-color);
            background-color: var(--primary-light);
        }

        .question-number.active {
            border-color: var(--primary-color);
            background-color: var(--primary-color);
            color: white;
        }

        .question-number.answered {
            border-color: var(--success-color);
            background-color: var(--success-color);
            color: white;
        }

        /* 右侧答题区 */
        .answer-area {
            flex: 1;
            background-color: var(--card-bg);
            border-radius: 0.5rem;
            box-shadow: var(--shadow);
            padding: 1.5rem;
            height: fit-content;
            max-height: calc(100vh - 120px);
            overflow-y: auto;
        }

        .question-header {
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-color);
        }

        .question-header h2 {
            font-size: 1.25rem;
            margin-bottom: 0.5rem;
        }

        .question-score {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            background-color: var(--primary-light);
            color: var(--primary-color);
            border-radius: 999px;
            font-size: 0.75rem;
            font-weight: 500;
        }

        .question-content {
            margin-bottom: 1.5rem;
            font-size: 1rem;
            line-height: 1.6;
        }

        .question-options {
            margin-bottom: 1.5rem;
        }

        .option {
            display: flex;
            align-items: flex-start;
            gap: 0.75rem;
            padding: 0.75rem 1rem;
            border: 1px solid var(--border-color);
            border-radius: 0.375rem;
            margin-bottom: 0.75rem;
            cursor: pointer;
            transition: var(--transition);
        }

        .option:hover {
            background-color: var(--primary-light);
            border-color: var(--primary-color);
        }

        .option.selected {
            background-color: var(--primary-light);
            border-color: var(--primary-color);
        }

        .option input {
            margin-top: 0.35rem;
        }

        .option-label {
            flex: 1;
        }

        .answer-actions {
            display: flex;
            justify-content: space-between;
            margin-top: 2rem;
            padding-top: 1rem;
            border-top: 1px solid var(--border-color);
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }

        .modal.show {
            display: flex;
        }

        .modal-content {
            background-color: var(--card-bg);
            border-radius: 0.5rem;
            width: 90%;
            max-width: 500px;
            padding: 2rem;
            box-shadow: var(--shadow);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .modal-header h3 {
            font-size: 1.25rem;
            color: var(--text-color);
        }

        .close-modal {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-light);
        }

        .modal-body {
            margin-bottom: 1.5rem;
        }

        .modal-footer {
            display: flex;
            justify-content: flex-end;
            gap: 1rem;
        }

        /* 判卷中弹窗样式 */
        #judgingModal .modal-body {
            text-align: center;
            padding: 1rem 0;
        }

        .spinner {
            width: 40px;
            height: 40px;
            margin: 0 auto 1rem;
            border: 4px solid var(--primary-light);
            border-top: 4px solid var(--primary-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* 响应式设计 */
        @media (max-width: 1024px) {
            .exam-content {
                flex-direction: column;
            }

            .question-nav {
                width: 100%;
                max-height: 300px;
            }

            .answer-area {
                max-height: none;
            }
        }

        @media (max-width: 768px) {
            .exam-header {
                flex-direction: column;
                align-items: flex-start;
                gap: 1rem;
            }

            .timer-container {
                width: 100%;
                justify-content: space-between;
            }

            .main-container {
                padding: 1rem;
            }
        }
    </style>
</head>
<body>
<div class="main-container">
    <!-- 顶部导航栏 -->
    <header class="exam-header">
        <h1 class="exam-title" id="examName">考试名称</h1>
        <div class="timer-container">
            <div class="timer" id="timer">00:00</div>
            <button class="btn danger" id="submitBtn">交卷</button>
        </div>
    </header>

    <!-- 主要内容区 -->
    <div class="exam-content">
        <!-- 左侧题目导航 -->
        <div class="question-nav" id="questionNav">
            <!-- 选择题 -->
            <div class="question-type" id="choiceQuestionsNav">
                <h3>选择题</h3>
                <div class="question-numbers" id="choiceQuestionNumbers">
                    <!-- 题目编号将通过JS动态生成 -->
                </div>
            </div>

            <!-- 填空题 -->
            <div class="question-type" id="fillQuestionsNav">
                <h3>填空题</h3>
                <div class="question-numbers" id="fillQuestionNumbers">
                    <!-- 题目编号将通过JS动态生成 -->
                </div>
            </div>

            <!-- 判断题 -->
            <div class="question-type" id="judgeQuestionsNav">
                <h3>判断题</h3>
                <div class="question-numbers" id="judgeQuestionNumbers">
                    <!-- 题目编号将通过JS动态生成 -->
                </div>
            </div>

            <!-- 主观题 -->
            <div class="question-type" id="essayQuestionsNav">
                <h3>主观题</h3>
                <div class="question-numbers" id="essayQuestionNumbers">
                    <!-- 题目编号将通过JS动态生成 -->
                </div>
            </div>

            <!-- 计算题 -->
            <div class="question-type" id="calculateQuestionsNav">
                <h3>计算题</h3>
                <div class="question-numbers" id="calculateQuestionNumbers">
                    <!-- 题目编号将通过JS动态生成 -->
                </div>
            </div>
        </div>

        <!-- 右侧答题区 -->
        <div class="answer-area" id="answerArea">
            <div class="question-header">
                <h2 id="currentQuestionTitle">请选择左侧题目开始作答</h2>
                <span class="question-score" id="currentQuestionScore">分值：0分</span>
            </div>

            <div class="question-content" id="currentQuestionContent">
                <!-- 题目内容将通过JS动态生成 -->
            </div>

            <div class="question-answer" id="currentQuestionAnswer">
                <!-- 答题区域将通过JS动态生成 -->
            </div>

            <div class="answer-actions">
                <button class="btn primary" id="prevQuestionBtn">上一题</button>
                <button class="btn primary" id="nextQuestionBtn">下一题</button>
            </div>
        </div>
    </div>
</div>

<!-- 确认交卷弹窗 -->
<div id="submitModal" class="modal">
    <div class="modal-content">
        <div class="modal-header">
            <h3>确认交卷</h3>
            <button class="close-modal" id="closeSubmitModal">&times;</button>
        </div>
        <div class="modal-body">
            <p>您确定要交卷吗？交卷后将无法修改答案。</p>
        </div>
        <div class="modal-footer">
            <button class="btn primary" id="cancelSubmitBtn">取消</button>
            <button class="btn danger" id="confirmSubmitBtn">确认交卷</button>
        </div>
    </div>
</div>

<!-- 时间到提示弹窗 -->
<div id="timeUpModal" class="modal">
    <div class="modal-content">
        <div class="modal-header">
            <h3>考试时间结束</h3>
        </div>
        <div class="modal-body">
            <p>考试时间已结束，系统将自动为您交卷。</p>
        </div>
        <div class="modal-footer">
            <button class="btn primary" id="confirmTimeUpBtn">确定</button>
        </div>
    </div>
</div>

<!-- 判卷中提示弹窗 -->
<div id="judgingModal" class="modal">
    <div class="modal-content">
        <div class="modal-header">
            <h3>正在处理</h3>
        </div>
        <div class="modal-body">
            <div class="spinner"></div>
            <p>稍等片刻，正在提交中，请不要关闭</p>
        </div>
    </div>
</div>

<!-- 通用提示弹窗 -->
<div id="alertModal" class="modal">
    <div class="modal-content">
        <div class="modal-header">
            <h3 id="alertTitle">提示</h3>
            <button class="close-modal" id="closeAlertModal">&times;</button>
        </div>
        <div class="modal-body">
            <p id="alertMessage"></p>
        </div>
        <div class="modal-footer">
            <button class="btn primary" id="confirmAlertBtn">确定</button>
        </div>
    </div>
</div>

<!-- JavaScript 引用 -->
<script src="../static/js/exam.js"></script>
</body>
</html>
